<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script src="../node_modules/axios/dist/axios.min.js"></script>
</head>
<body>
<button>发送请求</button>
</body>
<script type="module">
	import axios from "./myAxios.js";
	axios.defaults.baseURL = "http://zhangpeiyue.com";
	// 1- 先定义后执行
	// 2- 接收配置信息
	// 3- 有返回值，数字(完成）
	const r1= axios.interceptors.request.use(function(config){
		console.log("请求拦截1");
		return config;
	});
	const r2= axios.interceptors.request.use(function(config){
		console.log("请求拦截2");
		return config;
	});
	const s1= axios.interceptors.response.use(function(res){
		console.log("响应拦截1");
		return res;
	});
	const s2= axios.interceptors.response.use(function(res){
		console.log("响应拦截2");
		return res.data;
	});
	axios.interceptors.request.eject(r1);
	// axios.interceptors.request.eject(r2);
	axios.interceptors.response.eject(s1);
	axios.interceptors.response.eject(s2);
	console.log(r1,r2,s1,s2);
	const btn = document.querySelector("button");
	btn.onclick = async function () {
		const result = await axios.get("/scoreList");
		console.log(result);
	}
</script>
</html>